#!/usr/bin/env bats

@test "filter no-around no-color no-case: 2 words" {
  cd $BATS_TEST_DIRNAME
  expected="file11:6:Present is dejected here;"
  result="$(fish -c 'tbgs Present dejected')"; [ "$result" = "$expected" ]
  result="$(fish -c 'tbgs no-case Present dejected')"; [ "$result" = "$expected" ]
  result="$(fish -c 'tbgs Present no-color dejected')"; [ "$result" = "$expected" ]
  result="$(fish -c 'tbgs no-case Present dejected no-color')"; [ "$result" = "$expected" ]
  result="$(fish -c 'tbgs Present no-case dejected no-color')"; [ "$result" = "$expected" ]
  result="$(fish -c 'tbgs dejected Present')"; [ "$result" = "$expected" ]
  result="$(fish -c 'tbgs no-case dejected Present')"; [ "$result" = "$expected" ]
  result="$(fish -c 'tbgs dejected Present no-color')"; [ "$result" = "$expected" ]
  result="$(fish -c 'tbgs no-case dejected no-color Present')"; [ "$result" = "$expected" ]
  result="$(fish -c 'tbgs dejected no-case Present no-color')"; [ "$result" = "$expected" ]
  result="$(fish -c 'tbgs present dejected')"; [ "$result" = "$expected" ]
  result="$(fish -c 'tbgs Present dejEcTeD')"; [ "$result" = "$expected" ]
  result="$(fish -c 'tbgs dejected present')"; [ "$result" = "$expected" ]
  result="$(fish -c 'tbgs dejEcTeD Present')"; [ "$result" = "$expected" ]
  result="$(fish -c 'tbgs present no-case dejected no-color')"; [ "$result" = "$expected" ]
  result="$(fish -c 'tbgs Present no-case dejEcTeD')"; [ "$result" = "$expected" ]
  result="$(fish -c 'tbgs dejected no-case present no-color')"; [ "$result" = "$expected" ]
  result="$(fish -c 'tbgs dejEcTeD no-case Present')"; [ "$result" = "$expected" ]
}

@test "filter no-around no-color no-case: 4 words" {
  cd $BATS_TEST_DIRNAME
  expected="file11:4:Merry days will come, believe."
  result="$(fish -c 'tbgs Merry days will come')"; [ "$result" = "$expected" ]
  result="$(fish -c 'tbgs days will come Merry')"; [ "$result" = "$expected" ]
  result="$(fish -c 'tbgs will come Merry days')"; [ "$result" = "$expected" ]
  result="$(fish -c 'tbgs come Merry days will')"; [ "$result" = "$expected" ]
  result="$(fish -c 'tbgs merry days will come')"; [ "$result" = "$expected" ]
  result="$(fish -c 'tbgs days will cOMe Merry')"; [ "$result" = "$expected" ]
  result="$(fish -c 'tbgs wILl come Merry dAYs')"; [ "$result" = "$expected" ]
  result="$(fish -c 'tbgs cOMe Merry days will')"; [ "$result" = "$expected" ]
  result="$(fish -c 'tbgs Merry days will come no-case')"; [ "$result" = "$expected" ]
  result="$(fish -c 'tbgs days will come Merry no-case')"; [ "$result" = "$expected" ]
  result="$(fish -c 'tbgs will come Merry days no-case')"; [ "$result" = "$expected" ]
  result="$(fish -c 'tbgs come Merry days will no-case')"; [ "$result" = "$expected" ]
  result="$(fish -c 'tbgs merry days will come no-case')"; [ "$result" = "$expected" ]
  result="$(fish -c 'tbgs days will cOMe Merry no-case')"; [ "$result" = "$expected" ]
  result="$(fish -c 'tbgs wILl come Merry dAYs no-case')"; [ "$result" = "$expected" ]
  result="$(fish -c 'tbgs cOMe Merry days will no-case')"; [ "$result" = "$expected" ]
}

@test "filter no-around no-color no-case: 2 words partial match" {
  cd $BATS_TEST_DIRNAME
  expected="file11:6:Present is dejected here;"
  result="$(fish -c 'tbgs Pres dejec')"; [ "$result" = "$expected" ]
  result="$(fish -c 'tbgs no-case Pres dejec')"; [ "$result" = "$expected" ]
  result="$(fish -c 'tbgs Pres no-color dejec')"; [ "$result" = "$expected" ]
  result="$(fish -c 'tbgs no-case Pres dejec no-color')"; [ "$result" = "$expected" ]
  result="$(fish -c 'tbgs Pres no-case dejec no-color')"; [ "$result" = "$expected" ]
  result="$(fish -c 'tbgs dejec Pres')"; [ "$result" = "$expected" ]
  result="$(fish -c 'tbgs no-case dejec Pres')"; [ "$result" = "$expected" ]
  result="$(fish -c 'tbgs dejec Pres no-color')"; [ "$result" = "$expected" ]
  result="$(fish -c 'tbgs no-case dejec no-color Pres')"; [ "$result" = "$expected" ]
  result="$(fish -c 'tbgs dejec no-case Pres no-color')"; [ "$result" = "$expected" ]
  result="$(fish -c 'tbgs pres dejec')"; [ "$result" = "$expected" ]
  result="$(fish -c 'tbgs Pres dejEc')"; [ "$result" = "$expected" ]
  result="$(fish -c 'tbgs dejec pres')"; [ "$result" = "$expected" ]
  result="$(fish -c 'tbgs dejEc Pres')"; [ "$result" = "$expected" ]
  result="$(fish -c 'tbgs pres no-case dejec no-color')"; [ "$result" = "$expected" ]
  result="$(fish -c 'tbgs Pres no-case dejEc')"; [ "$result" = "$expected" ]
  result="$(fish -c 'tbgs dejec no-case pres no-color')"; [ "$result" = "$expected" ]
  result="$(fish -c 'tbgs dejEc no-case Pres')"; [ "$result" = "$expected" ]
}

@test "filter no-around no-color no-case: 2 words word only appears in file path" {
  cd $BATS_TEST_DIRNAME
  expected=""
  result="$(fish -c 'tbgs Present file')"; [ "$result" = "$expected" ]
  result="$(fish -c 'tbgs file dejected')"; [ "$result" = "$expected" ]
  result="$(fish -c 'tbgs the file')"; [ "$result" = "$expected" ]
}
